﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Web;

namespace WcfService
{
    public class IISServiceHostFactory : ServiceHostFactory
    {
        private string httpGetUrl;

        public override ServiceHostBase CreateServiceHost(string constructorString, Uri[] baseAddresses)
        {
            string[] arr = constructorString.Split(';');
            string serviceType = arr[0];
            httpGetUrl = arr[1];
            return base.CreateServiceHost(serviceType, baseAddresses);
        }

        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
        {
            //return base.CreateServiceHost(serviceType, baseAddresses);
            return new IISServiceHost(serviceType, httpGetUrl, baseAddresses);
        }
    }
}